﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Media.Effects;

namespace WpfChartingControlLibraryTest
{
    /// <summary>
    /// Interaction logic for PieChartWindow1.xaml
    /// </summary>
    public partial class PieChartWindow1 : Window
    {
        public PieChartWindow1()
        {
            InitializeComponent();
        }

        public System.Collections.ObjectModel.ObservableCollection<ChartingModel.Collections.PieChartDataList> dl = new System.Collections.ObjectModel.ObservableCollection<ChartingModel.Collections.PieChartDataList>();

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Effect eft = new DropShadowEffect();

            pieChart.DataList.Clear();

            //used for performance boost
            this.pieChart.DataListAutoUpdate = false;
            for (int i = 0; i < 5; i++)
            {
                pieChart.DataList.Add(new ChartingModel.Collections.PieChartDataList() { Item = .3333, Label = "A Label", BrushColor = Brushes.BurlyWood, MyEffect = eft });//, Explode = 0, MyEffect = new BlurEffect()});
                pieChart.DataList.Add(new ChartingModel.Collections.PieChartDataList() { Item = .10, Label = "A Label", BrushColor = Brushes.Purple, Explode = 0, MyEffect = eft });
                pieChart.DataList.Add(new ChartingModel.Collections.PieChartDataList() { Item = 0.33333, Label = "A Label", BrushColor = Brushes.Green, Explode = 0, MyEffect = eft });//, MyEffect = new BlurEffect()});
                pieChart.DataList.Add(new ChartingModel.Collections.PieChartDataList() { Item = .05, Label = "A Laffbel", BrushColor = Brushes.Beige, Explode = 0, MyEffect = eft });
                //            dl.Add(new ChartingModel.Collections.PieChartDataList() { Item = .05, Label = "A Laffbel", BrushColor = Brushes.Beige, Explode = 0 });
                //            pieChart.DataList.Add(new ChartingModel.Collections.PieChartDataList() { Item = .33330, Label = "A Labeffffl", BrushColor = Brushes.Gold, Explode = 0 });
            }

            pieChart.AddChart();
            this.pieChart.DataListAutoUpdate = true;
        }

        private void pieChart_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            if (pieChart.SelectedIndex != -1)
            {
              pieChart.DataList[this.pieChart.SelectedIndex].Explode = 20;
       //     pieChart.DataList.Add(new ChartingModel.Collections.PieChartDataList() { Item = 5000, Label = "A Label", BrushColor = Brushes.Green, Explode = 0 });
        
                
            }}
    }
}
